$(function(){
	$(function(){
		var els = ['#header', '#content', '#sidebar', '#footer', '#trashcan'];
		var $els = $(els.toString());
        // $els.droppable({
        //     accept: els,
        //     drop: function(ev,ul){
        //         var drag = ui.draggable;
        //         drag.appendTo($(this).siblings($("ul",$els)));
        //     }
        // });
		
		// $("h2", $els.slice(0,-1)).append('<span class="options"><a class="add"><img src="add.gif" border="0"></a></span>');
		// $("dt", $els).append('<span class="options"><a class="up"><img src="up.gif" border="0"></a></span>');
		
		// $("a.add").bind("click", addItem);
		// $("a.up").bind("click", moveUp);
		
		$els.sortable({
			items: '> ul',
			// handle: 'h2',
			cursor: 'move',
			opacity: 0.8,
			appendTo: 'body',
			connectWith: els,
			// change: sortableChange,
			// update: sortableUpdate
		});
	});
});
$(function(){
        get_image();
        get_explain();
});
function get_image() {
      $.getJSON("{{url controller="study" action="image"}}",
        {word:'apple'},
        function(data){
            var str = "<div><img alt='"+data.pic_text+"' src='/vvdict/index.php?controller=search&action=showbysize&id="+data.pic_id+"'/><p>"+data.pic_text+"</p></div><div><p>例句:</p><li>"+data.En_Sen+"</li><li>"+data.Chi_Sen+"</li></div></div>";
            $("div#content div#pic").append(str);
        }); 
}
function get_explain() {
     // $.getJSON("{{url controller="study" action="explain"}}",
     //    {word:'apple'},
     //    function(data){
     //        var str = "<p>"+data.Word+str2img(data.YinBiao)+"</p><p>"+data.HanYuJieshe+"</p>";
     //        $("div#content div#explain").append(str);
     //    });
}
function toggle_explain() {
    if($("#chk_explain").attr("checked")){
        $("div#content div#explain").css("visibility","visible");
    }
    else {
        $("div#content div#explain").css("visibility","hidden");
    }
}
function toggle_example() {
    if($("#chk_example").attr("checked")){
        $("div#content div#example").css("visibility","visible");
    }
    else {
        $("div#content div#example").css("visibility","hidden");
    }
}
function toggle_pic() {
    if($("#chk_pic").attr("checked")){
        $("div#content div#pic li").css("visibility","visible");
    }
    else {
        $("div#content div#pic li").css("visibility","hidden");
    }
}
